<template>
	<view class="balance">
		<u-toast ref="uToast"></u-toast>
		<u-navbar title="结算信息">
			<view class="u-m-r-20" slot="right" @click="goUpdate()">
				修改
			</view>

		</u-navbar>
		<view class="content">
			<view class="balance__top">
				<view class="balance__card  ">
					<u-cell-item :title="accountData.bankName" :arrow="false" :border-bottom="false">
						<u-image :src="thumb" width="40" height="40" slot="icon" class=" mr-10"></u-image>
					</u-cell-item>
					<view class="balance__account " v-if="accountData.accountNo">
						{{ '**** **** **** '  +  accountData.accountNo.substring(accountData.accountNo.length - 4)}}
					</view>

				</view>
			</view>



			<u-cell-group class="mt-20 ">
				<u-cell-item title="姓名" :value="accountData.accountName" :arrow="false"
					bg-color="#fffffF"></u-cell-item>
				<view class="" v-if="accountData.accountIdCard">
					<u-cell-item title="身份证号" bg-color="#fffffF"
						:value="accountData.accountIdCard.substring(0,1)+'****************'+accountData.accountIdCard.substring(accountData.accountIdCard.length - 1)"
						:arrow="false"></u-cell-item>
				</view>

			</u-cell-group>
		</view>




	</view>
</template>

<script>
	export default {
		data() {
			return {
				accountData: {},

				thumb: "/static/image/home/icon_bank_header.png",

			}
		},
		onNavigationBarButtonTap(event) {



			uni.navigateTo({
				url: "/packageD/pages/mine/settlement/settlementUpdate",
				events: {
					// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
					acceptDataFromOpenedPage: (data) => {
						console.log("data=" + JSON.stringify(data))
						if (data.data == "1") {
							this.querySetter();
						}
					},
				},
				success: (res) => {
					// 通过eventChannel向被打开页面传送数据
					res.eventChannel.emit('acceptDataFromOpenerPage', {
						data: 'data from starter page'
					})
				}


			});
		},
		mounted() {
			this.querySetter();
		},
		methods: {
			goUpdate() {
				uni.navigateTo({
					url: "/packageD/pages/mine/settlement/settlementUpdate",
					events: {
						// 为指定事件添加一个监听器，获取被打开页面传送到当前页面的数据
						acceptDataFromOpenedPage: (data) => {
							console.log("data=" + JSON.stringify(data))
							if (data.data == "1") {
								this.querySetter();
							}
						},
					},
					success: (res) => {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataFromOpenerPage', {
							data: 'data from starter page'
						})
					}


				});
			},
			querySetter() {
				const _that = this;
				this.$zx.user_api.querySetter().then((data) => {

					// console.log("data=" + JSON.stringify(data))
					this.accountData = data;
				});
			},
		},

	}
</script>

<style scoped lang="scss">
	.balance {
		&__top {
			background-color: white;
			padding: 20rpx;
		}

		&__card {
			background-image: url("http://118.31.238.190/home/img_settlement_info_bg.png");
			height: 336rpx;
			background-position: 50% 50%;
			background-repeat: no-repeat;
			background-size: 100%;
			// margin: 30rpx 30rpx;
			border-radius: 20rpx;
			border: 1rpx solid #f6f6f6;

		}

		&__account {

			display: flex;
			justify-content: center;
			margin-top: 80rpx;
			font-size: 22px;
			font-weight: bold;
		}
	}
</style>